home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 July / Macworld (1999-07).dmg / Serious Software / OpenWorld demo 2.0 / Development / Headers / OpenWorld_plugIn.h next >
Text File  |  1999-04-24  |  4KB  |  114 lines

  1. /*
  2. OpenWorld_plugIn.h
  3.  
  4. OpenWorld API Interface
  5.  
  6. Version 2.0
  7. Copyright ©1998-99, Marco Bambini, Inc. All rights reserved.
  8. */
  9.  
  10. #ifndef __OPENWORLD_PLUGIN__
  11. #define __OPENWORLD_PLUGIN__
  12.  
  13. #include <MixedMode.h>
  14. #include <OSA.h>
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <ctype.h>
  18. #include <string.h>
  19. #include "WSAPI.h"
  20.  
  21. // Types
  22. typedef struct
  23.     {    long                 message;            // type of operation to perform
  24.         long                version;            // plug-in version
  25.         long                customData;            // plug-in custom data
  26.         char                *search;            // the search argument
  27.         const char            *inputText;            // text passed by OpenWorld
  28.          char                *outputText;        // text returned from the plug-in
  29.          long                dim;                // lenght of the input/output text
  30.         FSSpec                myFile;                // FSSpec to the open file
  31.         short                fRef;                // file reference number of the open file
  32.         
  33.         /* Reserved parameters DON'T USE */
  34.         char                 reserved0[256];
  35.         long                reserved1;
  36.         long                reserved2;
  37.          char                reserved3[512];
  38.          short                reserved4;
  39.         short                reserved5;
  40.         Boolean                reserved6;
  41.         long                reserved7;
  42.         
  43.         /* Private parameters DON'T USE*/
  44.         ComponentInstance    scriptingComponent;
  45.         WSAPI_CommandPBPtr     pb;
  46.         UniversalProcPtr    OW_NewPtr;
  47.         UniversalProcPtr    OW_NewHandle;
  48.         UniversalProcPtr    OW_DisposePtr;
  49.         UniversalProcPtr    OW_DisposeHandle;
  50.         UniversalProcPtr    OW_GetServerInfo;
  51.         UniversalProcPtr    OW_DisposeServerInfo;
  52.         UniversalProcPtr    OW_TextToHTML;
  53.     } data;
  54.     
  55. typedef data *dataPtr;
  56.  
  57. // Messages
  58. #define    init_message        1L
  59. #define    run_message            2L            
  60. #define stop_message        3L
  61. #define end_message            4L
  62.  
  63. #define    kSingleTag            0
  64. #define    kDoubleTag            1
  65.  
  66. #define kVersion        (long) 0x2000    // means: 2.0.0 revision 0
  67. #define    kUnused                0L
  68.  
  69. // ProcInfo
  70. enum { 
  71.         uppMainEntryProcInfo = kCStackBased
  72.                                 | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))     
  73.                                 | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr)))
  74. };
  75.  
  76. enum {
  77.         uppAllocateMemProcInfo = kCStackBased
  78.                                 | RESULT_SIZE(SIZE_CODE(sizeof(void *)))
  79.                                 | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WSAPI_CommandPBPtr)))
  80.                                 | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long)))
  81. };
  82.  
  83. enum {
  84.         uppFreeMemProcInfo        = kCStackBased
  85.                                 | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WSAPI_CommandPBPtr)))
  86.                                 | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(void *)))
  87. };
  88.  
  89. enum {
  90.         uppGetParameterProcInfo = kCStackBased
  91.                                 | RESULT_SIZE(SIZE_CODE(sizeof(char *)))
  92.                                 | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WSAPI_CommandPBPtr)))
  93.                                 | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WSAPI_ParamKeywords)))
  94.                                 | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(unsigned long *)))
  95. };
  96.  
  97. enum {
  98.         uppTextToHTMLProcInfo   = kCStackBased
  99.                                 | RESULT_SIZE(SIZE_CODE(sizeof(char *)))
  100.                                 | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WSAPI_CommandPBPtr)))
  101.                                 | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(char *)))
  102.                                 | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(long *)))
  103. };
  104.  
  105. #define OW_NewPtr(param,dim) (char *)CallUniversalProc(param->OW_NewPtr,uppAllocateMemProcInfo,param->pb,dim)
  106. #define OW_NewHandle(param,dim) (char *)CallUniversalProc(param->OW_NewHandle,uppAllocateMemProcInfo,param->pb,dim)
  107. #define OW_DisposePtr(param,data) CallUniversalProc(param->OW_DisposePtr,uppFreeMemProcInfo,param->pb,data)
  108. #define OW_DisposeHandle(param,data) CallUniversalProc(param->OW_DisposeHandle,uppFreeMemProcInfo,param->pb,data)
  109. #define OW_GetServerInfo(param,key,num) (char *)CallUniversalProc(param->OW_GetServerInfo,uppGetParameterProcInfo,param->pb,key,num)
  110. #define OW_DisposeServerInfo(param,data) CallUniversalProc(param->OW_DisposeServerInfo,uppFreeMemProcInfo,param->pb,data)
  111. #define OW_TextToHTML(param,text,num) (char *)CallUniversalProc(param->OW_TextToHTML,uppTextToHTMLProcInfo,param->pb,text,num)
  112. ProcInfoType    __procinfo=uppMainEntryProcInfo;
  113.  
  114. #endif